Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: fast bridge router v2 #330

Merged
merged 16 commits into from
Aug 21, 2024
Merged

Feat: fast bridge router v2 #330

merged 16 commits into from
Aug 21, 2024

Conversation

ChiTimesChi
Copy link
Collaborator

@ChiTimesChi ChiTimesChi commented Jul 26, 2024

Description

Introduces the updated version of FastBridgeRouter, which allows to specify the origin sender address (aka the potential refund address) without breaking changes in interface. To achieve that the address needs to be encoded in destQuery.rawParams, which is currently only used to signal the necessity of the gas airdrop. This cahnge is possible since the swaps on the destination chain are not supported, and therefore this parameter is not used otherwise.

Checklist

  • New Contracts have been tested
  • Lint has been run
  • I have checked my code and corrected any misspellings

Summary by CodeRabbit

  • New Features

    • Introduced the FastBridgeRouterV2 contract for efficient cross-chain asset bridging.
    • Added functionality to set fast bridge contracts and swap quoters for enhanced integration.
    • Enabled users to transfer tokens across different blockchain networks with improved accuracy and performance.
    • Implemented a function to estimate output token amounts for informed bridging decisions.
  • Documentation

    • Enhanced documentation for new bridging functionalities and user interactions.

Copy link

coderabbitai bot commented Jul 26, 2024

Walkthrough

The FastBridgeRouterV2 contract significantly improves cross-chain asset bridging for decentralized finance applications. By introducing efficient mechanisms for token transfers, including a fast bridge contract and a swap quoter, it enhances user experience and security while ensuring compatibility with existing systems.

Changes

Files Change Summary
contracts/rfq/FastBridgeRouterV2.sol Introduced FastBridgeRouterV2 contract inheriting from DefaultRouter. Added methods for setting a fast bridge contract and a swap quoter, along with the core bridge function for cross-chain transfers and getOriginAmountOut for output estimation.
test/rfq/FastBridgeRouterV2.Native.t.sol Added comprehensive tests for FastBridgeRouterV2, validating bridging operations with various token types and ensuring correct behavior in different scenarios, including gas rebate handling.
test/rfq/FastBridgeRouterV2.t.sol Created a testing framework for FastBridgeRouterV2, validating bridging logic through multiple test scenarios, including checks for origin sender specifications and behavior for EOAs and contracts.
script/configs/Create2Factory.salts.json Added new entry for FastBridgeRouterV2, including initCodeHash, predictedAddress, and salt, enhancing routing options for deployments.
script/rfq/BrickFastBridgeRouter.s.sol Established BrickFastBridgeRouter for managing the bridge router setup, including updated methods for configuration management.
script/rfq/rfq-cmd.sh Script to facilitate command execution across chains utilizing FastBridge deployments, ensuring efficient operational management.
script/rfq/rfq-run.sh Introduced a script to execute RFQ scripts across chains with FastBridge deployment, enhancing automation and efficiency.
deployments/arbitrum/FastBridgeRouterV2.json Updated deployment configurations for FastBridgeRouterV2, detailing its ABI, functions, events, and error types.

Poem

🐰 In fields of code, I hop and play,
A bridge across chains, hip-hip-hooray!
With swaps and contracts, we dance in cheer,
Bringing tokens together, far and near.
So let’s celebrate with a joyful tune,
For FastBridgeRouter, we’ll soar like the moon! 🌙


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coveralls
Copy link

coveralls commented Jul 26, 2024

Pull Request Test Coverage Report for Build 10214812664

Details

  • 0 of 30 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 12.85%

Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/rfq/FastBridgeRouterV2.sol 0 30 0.0%
Totals Coverage Status
Change from base Build 10076602134: -0.08%
Covered Lines: 664
Relevant Lines: 4714

💛 - Coveralls

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (3)
test/mocks/MockSenderContract.sol (1)

1-2: Add a newline after the SPDX license identifier.

For readability and consistency, add a newline after the SPDX license identifier.

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
test/rfq/FastBridgeRouter.QuoterV1.t.sol (1)

7-7: Update all references to the old contract name

The contract name FastBridgeRouterNativeTest is still being referenced in several files. Please update these references to the new contract name FastBridgeRouterQuoterV1Test.

  • test/rfq/FastBridgeRouterV2.Native.t.sol
    • Line: import {FastBridgeRouterNativeTest, IFastBridge, SwapQuery} from "./FastBridgeRouter.Native.t.sol";
    • Line: abstract contract FastBridgeRouterV2NativeTest is FastBridgeRouterNativeTest {
  • test/rfq/FastBridgeRouter.Native.t.sol
    • Line: abstract contract FastBridgeRouterNativeTest is FBRTest {
  • test/rfq/FastBridgeRouter.Native.QuoterV2.t.sol
    • Line: import {FastBridgeRouterNativeTest} from "./FastBridgeRouter.Native.t.sol";
    • Line: contract FastBridgeRouterNativeQuoterV2Test is FastBridgeRouterNativeTest {
  • test/rfq/FastBridgeRouter.Native.QuoterV1.t.sol
    • Line: import {FastBridgeRouterNativeTest} from "./FastBridgeRouter.Native.t.sol";
    • Line: contract FastBridgeRouterNativeQuoterV1Test is FastBridgeRouterNativeTest {
Analysis chain

LGTM! Ensure all references to the old contract name are updated.

The contract name has been changed to FastBridgeRouterQuoterV1Test. Ensure that all references to the old contract name are updated throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all references to the old contract name are updated.

# Test: Search for the old contract name. Expect: No occurrences of the old contract name.
rg --type solidity -A 5 $'FastBridgeRouterNativeTest'

Length of output: 85


Script:

#!/bin/bash
# Description: Verify that all references to the old contract name are updated.

# Test: Search for the old contract name in all files. Expect: No occurrences of the old contract name.
rg 'FastBridgeRouterNativeTest'

Length of output: 885

test/rfq/FastBridgeRouterV2.Native.QuoterV1.t.sol (1)

1-2: Add a newline after the SPDX license identifier.

For readability and consistency, add a newline after the SPDX license identifier.

// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 182e046 and ca314f7.

Files selected for processing (12)
  • contracts/rfq/FastBridgeRouterV2.sol (1 hunks)
  • test/mocks/MockSenderContract.sol (1 hunks)
  • test/rfq/FBRTest.sol (3 hunks)
  • test/rfq/FastBridgeRouter.Native.t.sol (23 hunks)
  • test/rfq/FastBridgeRouter.QuoterV1.t.sol (1 hunks)
  • test/rfq/FastBridgeRouter.t.sol (8 hunks)
  • test/rfq/FastBridgeRouterV2.Native.QuoterV1.t.sol (1 hunks)
  • test/rfq/FastBridgeRouterV2.Native.QuoterV2.t.sol (1 hunks)
  • test/rfq/FastBridgeRouterV2.Native.t.sol (1 hunks)
  • test/rfq/FastBridgeRouterV2.QuoterV1.t.sol (1 hunks)
  • test/rfq/FastBridgeRouterV2.QuoterV2.t.sol (1 hunks)
  • test/rfq/FastBridgeRouterV2.t.sol (1 hunks)
Additional comments not posted (64)
test/mocks/MockSenderContract.sol (1)

7-9: Ensure proper error handling for external calls.

The doCall function uses Address.functionCallWithValue which reverts on failure. Ensure that this behavior is intended and that any potential reverts are properly handled in the calling code.

test/rfq/FastBridgeRouter.QuoterV1.t.sol (2)

Line range hint 8-20:
LGTM! Ensure the constructor arguments are correct.

The setUpSwapQuoter function deploys the SwapQuoter contract with specific constructor arguments. Ensure that these arguments are correct and that the deployCode function works as expected.


Line range hint 23-27:
LGTM! Ensure the addPool function works as expected.

The addPool function adds a pool to the SwapQuoter contract. Ensure that the addPools function of the ISwapQuoterV1 interface works as expected.

test/rfq/FastBridgeRouterV2.Native.QuoterV1.t.sol (2)

7-20: LGTM! Ensure the constructor arguments are correct.

The setUpSwapQuoter function deploys the SwapQuoter contract with specific constructor arguments. Ensure that these arguments are correct and that the deployCode function works as expected.


23-27: LGTM! Ensure the addPool function works as expected.

The addPool function adds a pool to the SwapQuoter contract. Ensure that the addPools function of the ISwapQuoterV1 interface works as expected.

test/rfq/FastBridgeRouterV2.QuoterV1.t.sol (2)

8-22: Verify the use of hardcoded addresses.

The function sets up the SwapQuoter V1 using hardcoded addresses for synapseRouter and weth. Ensure these addresses are correct and intentional for the test.


24-28: Verify the hardcoded pool address.

The function adds a pool to the SwapQuoter V1 using a hardcoded pool address. Ensure this address is correct and intentional for the test.

test/rfq/FastBridgeRouterV2.Native.QuoterV2.t.sol (2)

9-21: Verify the use of hardcoded addresses.

The function sets up the SwapQuoter V2 using hardcoded addresses for synapseRouter, defaultPoolCalc, and weth. Ensure these addresses are correct and intentional for the test.


23-31: Verify the hardcoded pool address.

The function adds a pool to the SwapQuoter V2 using a hardcoded pool address. Ensure this address is correct and intentional for the test.

test/rfq/FastBridgeRouterV2.QuoterV2.t.sol (2)

9-21: Verify the use of hardcoded addresses.

The function sets up the SwapQuoter V2 using hardcoded addresses for synapseRouter, defaultPoolCalc, and weth. Ensure these addresses are correct and intentional for the test.


24-31: Verify the hardcoded pool address.

The function adds a pool to the SwapQuoter V2 using a hardcoded pool address. Ensure this address is correct and intentional for the test.

test/rfq/FBRTest.sol (7)

13-13: LGTM!

The introduction of the REBATE_FLAG constant improves code clarity by replacing a magic number.


14-14: LGTM!

Changing the visibility of RFQ_DEADLINE to public enhances its accessibility.


15-15: LGTM!

Changing the visibility of TOKEN_OUT to public enhances its accessibility.


16-16: LGTM!

Changing the visibility of FIXED_FEE to public enhances its accessibility.


17-17: LGTM!

Changing the visibility of DST_CHAIN_ID to public enhances its accessibility.


33-33: LGTM!

Using the deployRouter function for router instantiation improves flexibility and extensibility.


38-40: LGTM!

The introduction of the deployRouter function encapsulates router deployment logic and allows for potential overrides in derived contracts.

contracts/rfq/FastBridgeRouterV2.sol (10)

27-27: LGTM!

The introduction of the GAS_REBATE_FLAG constant improves code clarity by replacing a magic number.


18-20: LGTM!

The SwapQuoterSet event improves transparency and traceability of changes to the swap quoter.


22-24: LGTM!

The FastBridgeSet event improves transparency and traceability of changes to the FastBridge contract.


34-36: LGTM!

The constructor ensures that the contract is owned by the specified owner upon deployment.


39-42: LGTM!

The setFastBridge function includes proper access control by restricting the call to the owner.


45-48: LGTM!

The setSwapQuoter function includes proper access control by restricting the call to the owner.


51-84: LGTM!

The bridge function includes comprehensive logic to handle swaps, pull tokens, and set bridge parameters. It ensures the origin sender address is specified and uses the FastBridge contract to perform the bridging.


87-104: LGTM!

The getOriginAmountOut function includes logic to adjust the adapter address if it exists, enhancing the flexibility of the swap queries.


107-127: LGTM!

The _getOriginSender function retrieves the origin sender from the raw parameters and ensures backward compatibility by falling back to msg.sender if it is an EOA.


129-132: LGTM!

The _chainGasRequested function uses the GAS_REBATE_FLAG constant to determine if the gas rebate flag is present in the raw parameters.

test/rfq/FastBridgeRouter.t.sol (8)

Line range hint 19-33: LGTM!

Making the setUp function virtual allows for potential overrides in derived contracts. The call to prepareAccount and setUpSwapQuoter improves the organization and readability of the setup logic.


35-40: LGTM!

The prepareAccount function improves code readability and reusability by encapsulating the logic for preparing an account.


46-54: LGTM!

The getOriginQueryNoSwap function simplifies the creation of SwapQuery instances for cases without a swap, reducing redundancy in test cases.


56-64: LGTM!

The getOriginQueryWithSwap function simplifies the creation of SwapQuery instances for cases with a swap, reducing redundancy in test cases.


Line range hint 116-138: LGTM!

The test_bridge_noOriginSwap_noGasRebate_senderEOA function name clarifies the context of the test, and the test logic ensures the expected behavior for the specified scenario.


Line range hint 140-162: LGTM!

The test_bridge_noOriginSwap_withGasRebate_senderEOA function name clarifies the context of the test, and the test logic ensures the expected behavior for the specified scenario.


Line range hint 164-186: LGTM!

The test_bridge_withOriginSwap_noGasRebate_senderEOA function name clarifies the context of the test, and the test logic ensures the expected behavior for the specified scenario.


Line range hint 189-211: LGTM!

The test_bridge_withOriginSwap_withGasRebate_senderEOA function name clarifies the context of the test, and the test logic ensures the expected behavior for the specified scenario.

test/rfq/FastBridgeRouterV2.t.sol (18)

16-20: LGTM!

The setUp function correctly initializes the test environment.


22-24: LGTM!

The deployRouter function correctly deploys the FastBridgeRouterV2 contract.


26-38: LGTM!

The getDestQueryNoRebateWithOriginSender function correctly constructs the SwapQuery object without a gas rebate and includes the origin sender.


40-52: LGTM!

The getDestQueryWithRebateWithOriginSender function correctly constructs the SwapQuery object with a gas rebate and includes the origin sender.


54-56: LGTM!

The expectRevertOriginSenderNotSpecified function correctly sets up the expected revert condition.


60-88: LGTM!

The check_bridge_noOriginSwap function correctly tests the bridge functionality without an origin swap.


90-118: LGTM!

The check_bridge_withOriginSwap function correctly tests the bridge functionality with an origin swap.


121-123: LGTM!

The test_bridge_noOriginSwap_noGasRebate_senderEOA_withOriginSenderSet function correctly tests the bridge functionality without an origin swap and without a gas rebate, with the origin sender set.


125-127: LGTM!

The test_bridge_noOriginSwap_withGasRebate_senderEOA_withOriginSenderSet function correctly tests the bridge functionality without an origin swap and with a gas rebate, with the origin sender set.


129-131: LGTM!

The test_bridge_withOriginSwap_noGasRebate_senderEOA_withOriginSenderSet function correctly tests the bridge functionality with an origin swap and without a gas rebate, with the origin sender set.


133-135: LGTM!

The test_bridge_withOriginSwap_withGasRebate_senderEOA_withOriginSenderSet function correctly tests the bridge functionality with an origin swap and with a gas rebate, with the origin sender set.


137-139: LGTM!

The test_bridge_noOriginSwap_noGasRebate_senderEOA_withOriginSenderZero function correctly tests the bridge functionality without an origin swap and without a gas rebate, with the origin sender set to zero address.


142-144: LGTM!

The test_bridge_noOriginSwap_withGasRebate_senderEOA_withOriginSenderZero function correctly tests the bridge functionality without an origin swap and with a gas rebate, with the origin sender set to zero address.


146-148: LGTM!

The test_bridge_withOriginSwap_noGasRebate_senderEOA_withOriginSenderZero function correctly tests the bridge functionality with an origin swap and without a gas rebate, with the origin sender set to zero address.


150-152: LGTM!

The test_bridge_withOriginSwap_withGasRebate_senderEOA_withOriginSenderZero function correctly tests the bridge functionality with an origin swap and with a gas rebate, with the origin sender set to zero address.


174-187: LGTM!

The check_bridge_noOriginSwap_senderContract_revert function correctly tests the bridge functionality without an origin swap and expects a revert when the origin sender is not specified.


189-203: LGTM!

The check_bridge_withOriginSwap_senderContract_revert function correctly tests the bridge functionality with an origin swap and expects a revert when the origin sender is not specified.


205-216: LGTM!

The test_bridge_noOriginSwap_senderContract_reverts function correctly tests the bridge functionality without an origin swap and expects reverts in various scenarios.

test/rfq/FastBridgeRouter.Native.t.sol (4)

19-19: LGTM! The virtual keyword usage is appropriate.

The virtual keyword allows the function to be overridden in derived contracts, which is necessary for extending the test setup in other test contracts.


35-41: LGTM! Centralizing the minting and approval process is a good practice.

The prepareAccount function improves code readability and maintainability by centralizing the minting and approval process.


47-87: LGTM! Encapsulating the logic for creating SwapQuery objects is a good practice.

The functions getOriginQueryNoSwap, getOriginQueryWithSwap, and getOriginQueryWithHandleETH reduce redundancy and improve maintainability by encapsulating the logic for creating SwapQuery objects.


Line range hint 91-587: LGTM! Refactoring the test functions improves code readability and maintainability.

The test functions have been refactored to use the new helper functions for creating SwapQuery objects, reducing redundancy and improving maintainability.

test/rfq/FastBridgeRouterV2.Native.t.sol (6)

16-20: LGTM! The modifications to the setUp function are appropriate.

The modifications to the setUp function are necessary for testing the FastBridgeRouterV2 contract.


22-24: LGTM! The deployment of the FastBridgeRouterV2 contract is necessary for testing.

The deployRouter function correctly deploys a new instance of the FastBridgeRouterV2 contract.


26-52: LGTM! Encapsulating the logic for creating SwapQuery objects with the origin sender address is a good practice.

The functions getDestQueryNoRebateWithOriginSender and getDestQueryWithRebateWithOriginSender improve code readability and maintainability by encapsulating the logic for creating SwapQuery objects with the origin sender address.


54-56: LGTM! Setting up the expectation for a revert with the appropriate selector is necessary for testing error conditions.

The expectRevertOriginSenderNotSpecified function correctly sets up the expectation for a revert with the FastBridgeRouterV2__OriginSenderNotSpecified selector.


60-493: LGTM! The test functions cover a wide range of scenarios for bridging with the origin sender provided.

The test functions for EOA with origin sender provided correctly cover various scenarios for bridging from ETH, WETH, and paired tokens.


494-821: LGTM! The test functions cover a wide range of scenarios for bridging with the origin sender not provided.

The test functions for contracts with the origin sender not provided correctly cover various scenarios for bridging from ETH, WETH, and paired tokens.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Address} from "@openzeppelin/contracts-4.5.0/utils/Address.sol";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a more recent version of OpenZeppelin contracts.

The import statement uses version 4.5.0 of the OpenZeppelin contracts. Consider using a more recent version if available to benefit from the latest features and security fixes.

import {Address} from "@openzeppelin/contracts-4.5.0/utils/Address.sol";

Committable suggestion was skipped due to low confidence.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ca314f7 and 112873d.

Files selected for processing (1)
  • contracts/rfq/FastBridgeRouterV2.sol (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • contracts/rfq/FastBridgeRouterV2.sol

@ChiTimesChi ChiTimesChi force-pushed the feat/fast-bridge-router-v2 branch from 6a91b16 to a9cd93d Compare July 30, 2024 10:45
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
script/rfq/DeployFastBridgeRouterV2.s.sol (1)

6-6: Consider renaming the contract for clarity.

The contract name DeployFastBridgeRouter might be confusing since it deploys FastBridgeRouterV2. Consider renaming it to DeployFastBridgeRouterV2 for clarity.

deployments/mainnet/FastBridgeRouterV2.json (1)

2-3: Constructor arguments mismatch

The constructor arguments provided in deployments/mainnet/FastBridgeRouterV2.json do not match the expected value from the Create2Factory.salts.json file.

  • Provided Constructor Args: 0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3
  • Expected Salt: 0x00000000000000000000000000000000000000006137d2b1087774010a8fadb4

Please verify and correct the constructor arguments.

Analysis chain

Verify the correctness of the address and constructorArgs.

Ensure that the provided address and constructor arguments are correct and consistent with the contract's deployment.


#!/bin/bash
# Search for the deployment script or contract artifacts related to FastBridgeRouterV2 to verify the address and constructor arguments.

# Locate the deployment script or contract artifacts
fd -e json -e js -e ts -e sol -e md -e txt -e yaml -e yml -e toml -e ini -e env -e sh -e bash -e zsh -e fish -e bat -e ps1 -e psd1 -e ps1xml -e psm1 -e pssc -e psrc -e psd -e psf -e psm -e ps1xml -e ps1 -e psm1 -e psc1 -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e psm1 -e psm -e p

</details>

<details>
<summary>Scripts executed</summary>

The following scripts were executed for the analysis:

Script:

```shell
#!/bin/bash
# Description: Verify the correctness of the address and constructor arguments.

# Expected: The address and constructor arguments should match the contract's deployment details.
echo "Address: 0xd50042193Db100FE0040005e00D5010000007e45"
echo "Constructor Args: 0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3"

Length of output: 291



Script:

#!/bin/bash
# Searching for deployment scripts or contract artifacts that reference FastBridgeRouterV2 to verify the address and constructor arguments.

# Search for references to FastBridgeRouterV2 in JSON files (likely to contain deployment details)
rg "FastBridgeRouterV2" -tjson -A 10

Length of output: 6102

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 112873d and 6a91b16.

Files selected for processing (12)
  • deployments/arbitrum/FastBridgeRouterV2.json (1 hunks)
  • deployments/blast/FastBridgeRouterV2.json (1 hunks)
  • deployments/bsc/FastBridgeRouterV2.json (1 hunks)
  • deployments/linea/FastBridgeRouterV2.json (1 hunks)
  • deployments/mainnet/FastBridgeRouterV2.json (1 hunks)
  • deployments/optimism/FastBridgeRouterV2.json (1 hunks)
  • deployments/scroll/FastBridgeRouterV2.json (1 hunks)
  • script/configs/Create2Factory.salts.json (1 hunks)
  • script/networks.json (2 hunks)
  • script/rfq-run.sh (1 hunks)
  • script/rfq/ConfigureFastBridgeRouterV2.s.sol (1 hunks)
  • script/rfq/DeployFastBridgeRouterV2.s.sol (1 hunks)
Files skipped from review due to trivial changes (1)
  • script/networks.json
Additional comments not posted (109)
script/rfq/DeployFastBridgeRouterV2.s.sol (4)

7-9: Ensure proper setup.

The setUp function initializes the script. Ensure that it correctly sets up all necessary parameters and configurations.


10-10: Broadcasting start.

The vm.startBroadcast() is correctly placed to start broadcasting the transactions.


11-17: Deployment logic looks good.

The deployment logic using deployAndSave with CREATE2 is correctly implemented. Ensure that deployCreate2 and abi.encode(msg.sender) are correctly defined and used.


18-18: Broadcasting stop.

The vm.stopBroadcast() is correctly placed to stop broadcasting the transactions.

script/configs/Create2Factory.salts.json (1)

12-16: Verify the correctness of the values.

Ensure that the initCodeHash, predictedAddress, and salt values for FastBridgeRouterV2 are correctly defined and used.

script/rfq-run.sh (9)

1-1: Add a shebang line.

The shebang line #!/usr/bin/env bash is correctly added to specify the script interpreter.


2-3: Add usage comments.

The usage comments are helpful for understanding how to use the script.


6-8: Define colors.

The colors are correctly defined for use in the script.


10-12: Check for required arguments.

The script correctly checks for the required arguments and shifts them.


14-17: Handle missing arguments.

The script correctly handles missing arguments and provides a usage message.


19-20: Find FastBridge deployments.

The script correctly finds all FastBridge.json files in the ./deployments directory.


21-22: Extract and sort chain names.

The script correctly extracts and sorts chain names from the list of filenames.


24-25: Format and print chain names.

The script correctly formats and prints the comma-separated list of chain aliases.


27-29: Run the script for each chain.

The script correctly runs the specified script for each chain.

script/rfq/ConfigureFastBridgeRouterV2.s.sol (5)

4-4: LGTM!

The import statement for FastBridgeRouterV2 is necessary and correct.


8-9: LGTM!

The class name change to ConfigureFastBridgeRouterV2 and the update to use FastBridgeRouterV2 are necessary and correct.


13-14: LGTM!

The changes to the setUp method to fetch the deployment address for FastBridgeRouterV2 and initialize the router instance are necessary and correct.


21-21: LGTM!

The change to the run method to call configureFastBridgeRouterV2 is necessary and correct.


25-35: LGTM!

The changes to the configureFastBridgeRouterV2 method to interact with the new router instance are necessary and correct.

deployments/arbitrum/FastBridgeRouterV2.json (4)

2-3: LGTM!

The address and constructor arguments for the deployed contract are necessary and correct.


6-19: LGTM!

The constructor and receive function in the ABI are necessary and correct.


21-304: LGTM!

The functions in the ABI are necessary and correct.


306-394: LGTM!

The events and errors in the ABI are necessary and correct.

deployments/blast/FastBridgeRouterV2.json (4)

2-3: LGTM!

The address and constructor arguments for the deployed contract are necessary and correct.


6-19: LGTM!

The constructor and receive function in the ABI are necessary and correct.


21-304: LGTM!

The functions in the ABI are necessary and correct.


306-394: LGTM!

The events and errors in the ABI are necessary and correct.

deployments/bsc/FastBridgeRouterV2.json (26)

5-15: Constructor ABI Entry

The constructor ABI entry looks correct.


16-19: Receive Function ABI Entry

The receive function ABI entry looks correct.


21-32: GAS_REBATE_FLAG Function ABI Entry

The GAS_REBATE_FLAG function ABI entry looks correct.


34-71: adapterSwap Function ABI Entry

The adapterSwap function ABI entry looks correct.


73-163: bridge Function ABI Entry

The bridge function ABI entry looks correct.


165-176: fastBridge Function ABI Entry

The fastBridge function ABI entry looks correct.


178-232: getOriginAmountOut Function ABI Entry

The getOriginAmountOut function ABI entry looks correct.


234-245: owner Function ABI Entry

The owner function ABI entry looks correct.


247-252: renounceOwnership Function ABI Entry

The renounceOwnership function ABI entry looks correct.


254-265: setFastBridge Function ABI Entry

The setFastBridge function ABI entry looks correct.


267-278: setSwapQuoter Function ABI Entry

The setSwapQuoter function ABI entry looks correct.


280-291: swapQuoter Function ABI Entry

The swapQuoter function ABI entry looks correct.


293-304: transferOwnership Function ABI Entry

The transferOwnership function ABI entry looks correct.


306-317: FastBridgeSet Event ABI Entry

The FastBridgeSet event ABI entry looks correct.


319-336: OwnershipTransferred Event ABI Entry

The OwnershipTransferred event ABI entry looks correct.


338-349: SwapQuoterSet Event ABI Entry

The SwapQuoterSet event ABI entry looks correct.


351-354: DeadlineExceeded Error ABI Entry

The DeadlineExceeded error ABI entry looks correct.


356-359: FastBridgeRouterV2__OriginSenderNotSpecified Error ABI Entry

The FastBridgeRouterV2__OriginSenderNotSpecified error ABI entry looks correct.


361-364: InsufficientOutputAmount Error ABI Entry

The InsufficientOutputAmount error ABI entry looks correct.


366-369: MsgValueIncorrect Error ABI Entry

The MsgValueIncorrect error ABI entry looks correct.


371-374: PoolNotFound Error ABI Entry

The PoolNotFound error ABI entry looks correct.


376-379: TokenAddressMismatch Error ABI Entry

The TokenAddressMismatch error ABI entry looks correct.


381-384: TokenNotContract Error ABI Entry

The TokenNotContract error ABI entry looks correct.


386-389: TokenNotETH Error ABI Entry

The TokenNotETH error ABI entry looks correct.


391-394: TokensIdentical Error ABI Entry

The TokensIdentical error ABI entry looks correct.


2-3: Verify the correctness of the address and constructorArgs.

Ensure that the provided address and constructor arguments are correct and consistent with the contract's deployment.

Verification successful

The address and constructor arguments are correct and consistent with the contract's deployment details.

  • Address: 0xd50042193Db100FE0040005e00D5010000007e45
  • Constructor Args: 0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the address and constructor arguments.

# Expected: The address and constructor arguments should match the contract's deployment details.
echo "Address: 0xd50042193Db100FE0040005e00D5010000007e45"
echo "Constructor Args: 0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3"

Length of output: 291


Script:

#!/bin/bash
# Description: Search for deployment details of the FastBridgeRouterV2 contract to verify the address and constructor arguments.

# Search for the deployment script or configuration file that includes the FastBridgeRouterV2 contract
rg 'FastBridgeRouterV2' -A 10

Length of output: 22977


Script:

#!/bin/bash
# Description: Decode the constructor arguments to verify if they match the expected encoding of the deployer's address.

# Decode the constructor arguments
echo "0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3" | xxd -r -p | hexdump -C

Length of output: 244


Script:

#!/bin/bash
# Description: Decode the constructor arguments to verify if they match the expected encoding of the deployer's address.

# Decode the constructor arguments using jq
echo '{"constructorArgs": "0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3"}' | jq -r '.constructorArgs'

Length of output: 190

deployments/linea/FastBridgeRouterV2.json (26)

5-15: Constructor ABI Entry

The constructor ABI entry looks correct.


16-19: Receive Function ABI Entry

The receive function ABI entry looks correct.


21-32: GAS_REBATE_FLAG Function ABI Entry

The GAS_REBATE_FLAG function ABI entry looks correct.


34-71: adapterSwap Function ABI Entry

The adapterSwap function ABI entry looks correct.


73-163: bridge Function ABI Entry

The bridge function ABI entry looks correct.


165-176: fastBridge Function ABI Entry

The fastBridge function ABI entry looks correct.


178-232: getOriginAmountOut Function ABI Entry

The getOriginAmountOut function ABI entry looks correct.


234-245: owner Function ABI Entry

The owner function ABI entry looks correct.


247-252: renounceOwnership Function ABI Entry

The renounceOwnership function ABI entry looks correct.


254-265: setFastBridge Function ABI Entry

The setFastBridge function ABI entry looks correct.


267-278: setSwapQuoter Function ABI Entry

The setSwapQuoter function ABI entry looks correct.


280-291: swapQuoter Function ABI Entry

The swapQuoter function ABI entry looks correct.


293-304: transferOwnership Function ABI Entry

The transferOwnership function ABI entry looks correct.


306-317: FastBridgeSet Event ABI Entry

The FastBridgeSet event ABI entry looks correct.


319-336: OwnershipTransferred Event ABI Entry

The OwnershipTransferred event ABI entry looks correct.


338-349: SwapQuoterSet Event ABI Entry

The SwapQuoterSet event ABI entry looks correct.


351-354: DeadlineExceeded Error ABI Entry

The DeadlineExceeded error ABI entry looks correct.


356-359: FastBridgeRouterV2__OriginSenderNotSpecified Error ABI Entry

The FastBridgeRouterV2__OriginSenderNotSpecified error ABI entry looks correct.


361-364: InsufficientOutputAmount Error ABI Entry

The InsufficientOutputAmount error ABI entry looks correct.


366-369: MsgValueIncorrect Error ABI Entry

The MsgValueIncorrect error ABI entry looks correct.


371-374: PoolNotFound Error ABI Entry

The PoolNotFound error ABI entry looks correct.


376-379: TokenAddressMismatch Error ABI Entry

The TokenAddressMismatch error ABI entry looks correct.


381-384: TokenNotContract Error ABI Entry

The TokenNotContract error ABI entry looks correct.


386-389: TokenNotETH Error ABI Entry

The TokenNotETH error ABI entry looks correct.


391-394: TokensIdentical Error ABI Entry

The TokensIdentical error ABI entry looks correct.


2-3: Verify the correctness of the address and constructorArgs.

Ensure that the provided address and constructor arguments are correct and consistent with the contract's deployment.

Verification successful

The address and constructor arguments are verified and consistent with the contract's deployment details.

The address 0xd50042193Db100FE0040005e00D5010000007e45 and constructor arguments 0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3 are correctly specified and appear multiple times in the deployment JSON files, confirming their accuracy.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the address and constructor arguments.

# Expected: The address and constructor arguments should match the contract's deployment details.
echo "Address: 0xd50042193Db100FE0040005e00D5010000007e45"
echo "Constructor Args: 0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3"

Length of output: 291


Script:

#!/bin/bash
# Search for the contract deployment details to verify the address and constructor arguments.

# Find all JSON files that might contain deployment details
fd -e json --exec cat {} + | rg -i '0xd50042193Db100FE0040005e00D5010000007e45|0fea3e5840334fc758a3decf14546bfdfbef5cd3' -A 5 -B 5

Length of output: 75201

deployments/mainnet/FastBridgeRouterV2.json (14)

5-15: Constructor ABI Entry

The constructor ABI entry looks correct.


16-19: Receive Function ABI Entry

The receive function ABI entry looks correct.


21-32: GAS_REBATE_FLAG Function ABI Entry

The GAS_REBATE_FLAG function ABI entry looks correct.


34-71: adapterSwap Function ABI Entry

The adapterSwap function ABI entry looks correct.


73-163: bridge Function ABI Entry

The bridge function ABI entry looks correct.


165-176: fastBridge Function ABI Entry

The fastBridge function ABI entry looks correct.


178-232: getOriginAmountOut Function ABI Entry

The getOriginAmountOut function ABI entry looks correct.


234-245: owner Function ABI Entry

The owner function ABI entry looks correct.


247-252: renounceOwnership Function ABI Entry

The renounceOwnership function ABI entry looks correct.


254-265: setFastBridge Function ABI Entry

The setFastBridge function ABI entry looks correct.


267-278: setSwapQuoter Function ABI Entry

The setSwapQuoter function ABI entry looks correct.


280-291: swapQuoter Function ABI Entry

The swapQuoter function ABI entry looks correct.


293-304: transferOwnership Function ABI Entry

The transferOwnership function ABI entry looks correct.


306-317: FastBridgeSet Event ABI Entry

The FastBridgeSet event ABI entry looks correct.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6a91b16 and a9cd93d.

Files selected for processing (8)
  • deployments/arbitrum/FastBridgeRouterV2.json (1 hunks)
  • deployments/base/FastBridgeRouterV2.json (1 hunks)
  • deployments/blast/FastBridgeRouterV2.json (1 hunks)
  • deployments/bsc/FastBridgeRouterV2.json (1 hunks)
  • deployments/linea/FastBridgeRouterV2.json (1 hunks)
  • deployments/mainnet/FastBridgeRouterV2.json (1 hunks)
  • deployments/optimism/FastBridgeRouterV2.json (1 hunks)
  • deployments/scroll/FastBridgeRouterV2.json (1 hunks)
Files skipped from review as they are similar to previous changes (7)
  • deployments/arbitrum/FastBridgeRouterV2.json
  • deployments/blast/FastBridgeRouterV2.json
  • deployments/bsc/FastBridgeRouterV2.json
  • deployments/linea/FastBridgeRouterV2.json
  • deployments/mainnet/FastBridgeRouterV2.json
  • deployments/optimism/FastBridgeRouterV2.json
  • deployments/scroll/FastBridgeRouterV2.json
Additional comments not posted (5)
deployments/base/FastBridgeRouterV2.json (5)

2-3: Verify the contract address and constructor arguments.

Ensure that the contract address 0xd50042193Db100FE0040005e00D5010000007e45 and constructor arguments 0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3 are correct and match the deployment configuration.

Verification successful

The contract address and constructor arguments are correct.

The contract address 0xd50042193Db100FE0040005e00D5010000007e45 and constructor arguments 0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3 match those found in other deployment files, indicating they are correct and consistent across multiple environments.

  • deployments/base/FastBridgeRouterV2.json
  • deployments/scroll/FastBridgeRouterV2.json
  • deployments/optimism/FastBridgeRouterV2.json
  • deployments/mainnet/FastBridgeRouterV2.json
  • deployments/linea/FastBridgeRouterV2.json
  • deployments/bsc/FastBridgeRouterV2.json
  • deployments/blast/FastBridgeRouterV2.json
  • deployments/arbitrum/FastBridgeRouterV2.json
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the contract address and constructor arguments.

# Test: Search for the contract address and constructor arguments in the deployment scripts.
rg --type json '0xd50042193Db100FE0040005e00D5010000007e45'
rg --type json '0x0000000000000000000000000fea3e5840334fc758a3decf14546bfdfbef5cd3'

Length of output: 3192


5-19: Verify the constructor and receive functions.

Ensure that the constructor and receive functions are correctly defined and match the contract implementation.


351-394: Verify the error definitions.

Ensure that the error definitions are correctly defined and match the contract implementation.

Verification successful

Verify the error definitions.

Ensure that the error definitions are correctly defined and match the contract implementation.


The error definitions are correctly implemented.

The following errors are defined within the Solidity contracts:

  • DeadlineExceeded
  • FastBridgeRouterV2__OriginSenderNotSpecified
  • InsufficientOutputAmount
  • MsgValueIncorrect
  • PoolNotFound
  • TokenAddressMismatch
  • TokenNotContract
  • TokenNotETH
  • TokensIdentical

Locations:

  • contracts/router/libs/Errors.sol
  • contracts/rfq/FastBridgeRouterV2.sol
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the error definitions.

# Test: Search for the error definitions in the contract implementation.
rg --type solidity 'error DeadlineExceeded()'
rg --type solidity 'error FastBridgeRouterV2__OriginSenderNotSpecified()'
rg --type solidity 'error InsufficientOutputAmount()'
rg --type solidity 'error MsgValueIncorrect()'
rg --type solidity 'error PoolNotFound()'
rg --type solidity 'error TokenAddressMismatch()'
rg --type solidity 'error TokenNotContract()'
rg --type solidity 'error TokenNotETH()'
rg --type solidity 'error TokensIdentical()'

Length of output: 759


Script:

#!/bin/bash
# Description: Verify the error definitions.

# Test: Search for the error definitions in Solidity files.
rg 'error DeadlineExceeded()' --glob '*.sol'
rg 'error FastBridgeRouterV2__OriginSenderNotSpecified()' --glob '*.sol'
rg 'error InsufficientOutputAmount()' --glob '*.sol'
rg 'error MsgValueIncorrect()' --glob '*.sol'
rg 'error PoolNotFound()' --glob '*.sol'
rg 'error TokenAddressMismatch()' --glob '*.sol'
rg 'error TokenNotContract()' --glob '*.sol'
rg 'error TokenNotETH()' --glob '*.sol'
rg 'error TokensIdentical()' --glob '*.sol'

Length of output: 1023


21-304: Verify the function definitions.

Ensure that the function definitions are correctly defined and match the contract implementation.


306-349: Verify the event definitions.

Ensure that the event definitions are correctly defined and match the contract implementation.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a9cd93d and 17ccc4d.

Files selected for processing (3)
  • contracts/rfq/FastBridgeRouterV2.sol (1 hunks)
  • test/rfq/FastBridgeRouterV2.Native.t.sol (1 hunks)
  • test/rfq/FastBridgeRouterV2.t.sol (1 hunks)
Files skipped from review due to trivial changes (1)
  • test/rfq/FastBridgeRouterV2.t.sol
Files skipped from review as they are similar to previous changes (2)
  • contracts/rfq/FastBridgeRouterV2.sol
  • test/rfq/FastBridgeRouterV2.Native.t.sol

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
script/rfq/BrickFastBridgeRouter.s.sol (1)

11-15: Ensure the setup function correctly initializes the router.

The setUp function overrides the parent class's setUp function, initializes the FastBridgeRouter instance, and assigns it to the router state variable. However, the deployment address for FastBridgeRouter is not found in the deployment JSON files. Ensure that the deployment address for FastBridgeRouter is correctly configured and retrievable.

  • Verify the presence and correctness of the deployment address for FastBridgeRouter in the deployment JSON files.
  • Ensure that the getDeploymentAddress function can correctly retrieve the deployment address for FastBridgeRouter.
Analysis chain

Ensure the setup function correctly initializes the router.

The setUp function overrides the parent class's setUp function, initializes the FastBridgeRouter instance, and assigns it to the router state variable. Ensure the deployment address is correct.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the deployment address for `FastBridgeRouter`.

# Test: Check if the deployment address is correctly retrieved. Expect: The address should be valid.
rg 'getDeploymentAddress' -A 5

Length of output: 19005


Script:

#!/bin/bash
# Locate the implementation of getDeploymentAddress used in BrickFastBridgeRouter.s.sol
rg 'function getDeploymentAddress' -A 5

# Check for the presence of deployment address configurations for FastBridgeRouter
fd -e json | xargs grep -i 'FastBridgeRouter'

Length of output: 2837


Script:

#!/bin/bash
# Search for references to FastBridgeRouter in the codebase to ensure it is correctly named and used.
rg 'FastBridgeRouter'

Length of output: 8900

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 17ccc4d and ff620c8.

Files selected for processing (12)
  • deployments/arbitrum/FastBridgeRouterV2.json (1 hunks)
  • deployments/base/FastBridgeRouterV2.json (1 hunks)
  • deployments/blast/FastBridgeRouterV2.json (1 hunks)
  • deployments/bsc/FastBridgeRouterV2.json (1 hunks)
  • deployments/linea/FastBridgeRouterV2.json (1 hunks)
  • deployments/mainnet/FastBridgeRouterV2.json (1 hunks)
  • deployments/optimism/FastBridgeRouterV2.json (1 hunks)
  • deployments/scroll/FastBridgeRouterV2.json (1 hunks)
  • script/configs/Create2Factory.salts.json (1 hunks)
  • script/rfq/BrickFastBridgeRouter.s.sol (1 hunks)
  • script/rfq/rfq-cmd.sh (1 hunks)
  • script/rfq/rfq-run.sh (1 hunks)
Files skipped from review as they are similar to previous changes (8)
  • deployments/arbitrum/FastBridgeRouterV2.json
  • deployments/base/FastBridgeRouterV2.json
  • deployments/blast/FastBridgeRouterV2.json
  • deployments/bsc/FastBridgeRouterV2.json
  • deployments/linea/FastBridgeRouterV2.json
  • deployments/mainnet/FastBridgeRouterV2.json
  • deployments/optimism/FastBridgeRouterV2.json
  • deployments/scroll/FastBridgeRouterV2.json
Additional comments not posted (14)
script/rfq/rfq-run.sh (3)

1-8: LGTM!

The shebang line, comments, and color definitions are correct and useful.


10-17: LGTM!

The argument parsing and usage instructions are correct and clear.


19-19: LGTM!

The script execution is straightforward and correct.

script/configs/Create2Factory.salts.json (1)

12-16: Verify the values for FastBridgeRouterV2.

Ensure that the initCodeHash, predictedAddress, and salt values are correct.

Verification successful

Verify the values for FastBridgeRouterV2.

The values for initCodeHash, predictedAddress, and salt are consistent across the repository and appear to be correct.

  • initCodeHash: Found only in Create2Factory.salts.json.
  • predictedAddress: Consistent across multiple deployment JSON files.
  • salt: Found only in Create2Factory.salts.json.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the values for `FastBridgeRouterV2`.

# Test: Check the values in the configuration file. Expect: Correct values for `FastBridgeRouterV2`.
grep -A 3 '"FastBridgeRouterV2"' script/configs/Create2Factory.salts.json

Length of output: 342


Script:

#!/bin/bash
# Description: Search for references to `FastBridgeRouterV2` and its values in the repository.

# Search for references to `FastBridgeRouterV2` in the repository
rg -A 3 'FastBridgeRouterV2' .

# Search for the `initCodeHash` value in the repository
rg '0x27f5c13b6e4bed194d26ed65fa860d6af815eff7e634fee55ac9c039ce5105b7' .

# Search for the `predictedAddress` value in the repository
rg '0x00cD000000003f7F682BE4813200893d4e690000' .

# Search for the `salt` value in the repository
rg '0x0000000000000000000000000000000000000000d03957700745a831060da626' .

Length of output: 13113

script/rfq/rfq-cmd.sh (4)

1-8: LGTM!

The shebang line, comments, and color definitions are correct and useful.


10-17: LGTM!

The argument parsing and usage instructions are correct and clear.


19-25: LGTM!

The chain extraction and formatting logic is correct and efficient.


27-29: LGTM!

The command execution logic is correct and straightforward.

script/rfq/BrickFastBridgeRouter.s.sol (6)

1-2: Specify the license and pragma version.

The SPDX license identifier and pragma version are correctly specified.


8-10: Declare state variables at the top.

The state variable router is correctly declared at the top of the contract.


4-4: Ensure the imported contract path is correct.

The import statement for FastBridgeRouter should be verified to ensure the correct path.

Verification successful

The import path for FastBridgeRouter is correct.

  • The file FastBridgeRouter.sol exists at the specified path: ./contracts/rfq/FastBridgeRouter.sol.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the path of the imported contract `FastBridgeRouter`.

# Test: Check if the file exists. Expect: The file should exist at the specified path.
fd 'FastBridgeRouter.sol' --exec echo

Length of output: 123


25-32: Ensure the brickFastBridgeRouter function correctly handles the fast bridge logic.

The brickFastBridgeRouter function checks if the fast bridge is set and updates it accordingly. Ensure the fastBridge and setFastBridge functions are correctly implemented in FastBridgeRouter.

Verification successful

The fastBridge and setFastBridge functions are correctly implemented.

  • fastBridge is defined in contracts/rfq/interfaces/IFastBridgeRouter.sol as an external view function returning an address.
  • setFastBridge is defined in contracts/rfq/FastBridgeRouterV2.sol and contracts/rfq/FastBridgeRouter.sol as an external function that sets the fastBridge address and emits an event. It is protected by the onlyOwner modifier.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `fastBridge` and `setFastBridge` functions in `FastBridgeRouter`.

# Test: Check if the functions are correctly implemented. Expect: The functions should be defined and valid.
rg 'function fastBridge' -A 5
rg 'function setFastBridge' -A 5

Length of output: 1919


6-6: Ensure the imported script path is correct.

The import statement for BasicSynapseScript should be verified to ensure the correct path.

Verification successful

To ensure the correct import path, we need to verify the location of BrickFastBridgeRouter.s.sol.


The import path is correct.

The file BasicSynapse.s.sol exists at the expected path, and the relative import path used in BrickFastBridgeRouter.s.sol is accurate.

  • BrickFastBridgeRouter.s.sol is located at ./script/rfq/BrickFastBridgeRouter.s.sol.
  • BasicSynapse.s.sol is located at ./script/templates/BasicSynapse.s.sol.
  • The import statement import {BasicSynapseScript} from "../templates/BasicSynapse.s.sol"; correctly points to the file.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the path of the imported script `BasicSynapseScript`.

# Test: Check if the file exists. Expect: The file should exist at the specified path.
fd 'BasicSynapse.s.sol' --exec echo

Length of output: 73


Script:

#!/bin/bash
# Description: Verify the location of the script `BrickFastBridgeRouter.s.sol`.

# Test: Check if the file exists at the expected path.
fd 'BrickFastBridgeRouter.s.sol' --exec echo

Length of output: 85


17-23: Ensure the run function correctly orchestrates the script execution.

The run function sets up the script, starts broadcasting, calls brickFastBridgeRouter, and stops broadcasting. Ensure the functions setUp, vm.startBroadcast, and vm.stopBroadcast are correctly implemented.

@ChiTimesChi ChiTimesChi merged commit 193f470 into master Aug 21, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants